package com.youyi.yyviewsdklibrary.View;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.View;

import com.lkx.liandianqinew.R;
import com.zhy.android.percent.support.PercentLayoutHelper;

public class MyMarkView extends View {
    private static int BUTTON_EXTRA_WIDTH = 0;
    private static final int CornerStyleCircle = 1;
    private static final int CornerStyleLine = 0;
    private static final int CornerStyleNone = 2;
    private static final int DEFAULT_CANCEL_BUTTON_RES = R.drawable.mymarkview_close;
    private static final int DEFAULT_CONFIRM_BUTTON_RES = R.drawable.mymarkview_done;
    private static final int DEFAULT_MARKED_COLOR = Color.parseColor("#00000000");
    private static final int DEFAULT_STROKE_COLOR = Color.parseColor("#02B4FE");
    private static final int DEFAULT_STROKE_WIDTH = 2;
    private static final int DEFAULT_UNMARKED_COLOR = Color.parseColor("#80000000");
    private static final int DEFAULT_VERTEX_COLOR = Color.parseColor("#FFFFFF");
    private static final int DEFAULT_VERTEX_WIDTH = 20;
    private int adjustNum = 0;
    private Rect cancelArea;
    private Bitmap cancelBitmap;
    private int cancelButtonRes = DEFAULT_CANCEL_BUTTON_RES;
    private Rect confirmArea;
    private Bitmap confirmBitmap;
    private int confirmButtonRes = DEFAULT_CONFIRM_BUTTON_RES;
    private int cornerColor = DEFAULT_VERTEX_COLOR;
    private int cornerWidth;
    private int downX;
    private int downY;
    private int endX;
    private int endY;
    private boolean isAdjustMode = false;
    private boolean isButtonClicked = false;
    private boolean isMoveMode = false;
    private boolean isShowButtom = false;
    private boolean isTouchAble = true;
    private RectF lbVer;
    int lineLen = 50;
    int lineWidth = 10;
    private RectF ltVer;
    private int mActionGap;
    private Paint mBitPaint;
    private int mCornerStyle;
    private int mHeight;
    private int mMoveHeight;
    private int mMoveWidth;
    private int mNewBottom;
    private int mNewLeft;
    private int mNewRight;
    private int mNewTop;
    private onClickListener mOnClickListener;
    private int mWidth;
    private String markHeightPercent;
    private Paint markPaint;
    private String markWidthPercent;
    private Rect markedArea;
    private int markedColor = DEFAULT_MARKED_COLOR;
    private RectF rbVer;
    private RectF rtVer;
    private int startX;
    private int startY;
    private Paint unMarkPaint;
    private int unmarkedColor = DEFAULT_UNMARKED_COLOR;
    private Paint vertexPaint;

    public interface OnRectListener {
        void result(Rect rect);
    }

    public interface onClickListener {
        void onCancel();

        void onConfirm(Rect rect);

        void onTouch();
    }

    public MyMarkView(Context context) {
        super(context);
        init(context, null);
    }

    public MyMarkView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        init(context, attributeSet);
    }

    private void init(Context context, AttributeSet attributeSet) {
        BUTTON_EXTRA_WIDTH = dp2px(context, 8.0f);
        this.cornerWidth = dp2px(context, 20.0f);
        if (attributeSet != null) {
            TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.MyMarkView);
            this.markedColor = obtainStyledAttributes.getColor(R.styleable.MyMarkView_yyMarkColor, DEFAULT_MARKED_COLOR);
            this.unmarkedColor = obtainStyledAttributes.getColor(R.styleable.MyMarkView_yyUnMarkColor, DEFAULT_UNMARKED_COLOR);
            this.mCornerStyle = obtainStyledAttributes.getInt(R.styleable.MyMarkView_yyCornerStyle, 0);
            this.cornerColor = obtainStyledAttributes.getColor(R.styleable.MyMarkView_yyCornerColor, DEFAULT_VERTEX_COLOR);
            this.cornerWidth = obtainStyledAttributes.getDimensionPixelSize(R.styleable.MyMarkView_yyCornerWidth, dp2px(context, 20.0f));
            this.markWidthPercent = obtainStyledAttributes.getString(R.styleable.MyMarkView_yyMarkWidthPercent);
            this.markHeightPercent = obtainStyledAttributes.getString(R.styleable.MyMarkView_yyMarkHeightPercent);
            this.isTouchAble = obtainStyledAttributes.getBoolean(R.styleable.MyMarkView_isTouchAble, false);
            this.isShowButtom = obtainStyledAttributes.getBoolean(R.styleable.MyMarkView_isShowButton, false);
            this.confirmButtonRes = obtainStyledAttributes.getResourceId(R.styleable.MyMarkView_confirmButtonRes, DEFAULT_CONFIRM_BUTTON_RES);
            this.cancelButtonRes = obtainStyledAttributes.getResourceId(R.styleable.MyMarkView_cancleButtonRes, DEFAULT_CANCEL_BUTTON_RES);
        }
        Paint paint = new Paint();
        this.unMarkPaint = paint;
        paint.setColor(this.unmarkedColor);
        this.unMarkPaint.setAntiAlias(true);
        Paint paint2 = new Paint();
        this.markPaint = paint2;
        paint2.setColor(this.markedColor);
        this.markPaint.setStyle(Paint.Style.FILL);
        this.markPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
        this.markPaint.setColor(this.markedColor);
        this.markPaint.setAntiAlias(true);
        Paint paint3 = new Paint();
        this.vertexPaint = paint3;
        paint3.setColor(this.cornerColor);
        this.vertexPaint.setAntiAlias(true);
        Paint paint4 = new Paint(1);
        this.mBitPaint = paint4;
        paint4.setFilterBitmap(true);
        this.mBitPaint.setDither(true);
        this.confirmArea = new Rect();
        this.cancelArea = new Rect();
        this.ltVer = new RectF();
        this.rtVer = new RectF();
        this.lbVer = new RectF();
        this.rbVer = new RectF();
        this.confirmBitmap = BitmapFactory.decodeResource(getResources(), this.confirmButtonRes);
        this.cancelBitmap = BitmapFactory.decodeResource(getResources(), this.cancelButtonRes);
        this.mActionGap = dp2px(context, 15.0f);
        initNormal();
        setPercent(this.markWidthPercent, this.markHeightPercent);
    }

    public void setPercent(final String str, final String str2) {
        Log.d("MyMarkView111", str + ":" + str);
        if (!TextUtils.isEmpty(str) && !TextUtils.isEmpty(str2)) {
            post(new Runnable() {
                /* class com.youyi.yyviewsdklibrary.View.MyMarkView.AnonymousClass1 */

                public void run() {
                    int i;
                    int i2;
                    int width = MyMarkView.this.getWidth();
                    int height = MyMarkView.this.getHeight();
                    if (str.endsWith("w")) {
                        i = (MyMarkView.this.strToInt(str.replace("w", "")) * width) / 100;
                    } else {
                        i = (MyMarkView.this.strToInt(str.replace( "h", "")) * height) / 100;
                    }
                    if (str2.endsWith("w")) {
                        i2 = (MyMarkView.this.strToInt(str2.replace("w", "")) * width) / 100;
                    } else {
                        i2 = (MyMarkView.this.strToInt(str2.replace( "h", "")) * height) / 100;
                    }
                    int i3 = (width - i) / 2;
                    int i4 = (height - i2) / 2;
                    MyMarkView.this.setRect(new Rect(i3, i4, i + i3, i2 + i4));
                    MyMarkView.this.postInvalidate();
                }
            });
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private int strToInt(String str) {
        try {
            return Integer.parseInt(str);
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
        }
    }

    private void initNormal() {
        Rect rect = new Rect(100, 100, 300, 300);
        this.markedArea = rect;
        this.startX = rect.left;
        this.startY = this.markedArea.top;
        this.endX = this.markedArea.right;
        this.endY = this.markedArea.bottom;
    }

    /* access modifiers changed from: protected */
    public void onMeasure(int i, int i2) {
        super.onMeasure(i, i2);
        int i3 = 100;
        this.mWidth = MeasureSpec.getMode(i) == 0 ? 100 : MeasureSpec.getSize(i);
        if (MeasureSpec.getMode(i2) != 0) {
            i3 = MeasureSpec.getSize(i2);
        }
        this.mHeight = i3;
    }

    /* access modifiers changed from: protected */
    public void onDraw(Canvas canvas) {
        canvas.saveLayer(0.0f, 0.0f, (float) canvas.getWidth(), (float) canvas.getHeight(), null, 31);
        canvas.drawRect(0.0f, 0.0f, (float) getWidth(), (float) getHeight(), this.unMarkPaint);
        canvas.drawRect(this.markedArea, this.markPaint);
        Log.d("MyMarkView", "mCornerStyle:" + this.mCornerStyle);
        int i = this.mCornerStyle;
        if (i == 0) {
            drawLeftTopPath(this.markedArea.left, 1, this.markedArea.top, 1, canvas);
            drawLeftTopPath(this.markedArea.right, -1, this.markedArea.top, 1, canvas);
            drawLeftTopPath(this.markedArea.left, 1, this.markedArea.bottom, -1, canvas);
            drawLeftTopPath(this.markedArea.right, -1, this.markedArea.bottom, -1, canvas);
        } else if (i == 1) {
            if (this.ltVer.left == 0.0f && this.rbVer.left == 0.0f && this.lbVer.left == 0.0f && this.rbVer.left == 0.0f) {
                Log.d("MyMarkView", "ltVerleft:" + this.ltVer.left);
                this.ltVer.set((float) (this.markedArea.left - (this.cornerWidth / 2)), (float) (this.markedArea.top - (this.cornerWidth / 2)), (float) (this.markedArea.left + (this.cornerWidth / 2)), (float) (this.markedArea.top + (this.cornerWidth / 2)));
                this.rtVer.set((float) (this.markedArea.right - (this.cornerWidth / 2)), (float) (this.markedArea.top - (this.cornerWidth / 2)), (float) (this.markedArea.right + (this.cornerWidth / 2)), (float) (this.markedArea.top + (this.cornerWidth / 2)));
                this.lbVer.set((float) (this.markedArea.left - (this.cornerWidth / 2)), (float) (this.markedArea.bottom - (this.cornerWidth / 2)), (float) (this.markedArea.left + (this.cornerWidth / 2)), (float) (this.markedArea.bottom + (this.cornerWidth / 2)));
                this.rbVer.set((float) (this.markedArea.right - (this.cornerWidth / 2)), (float) (this.markedArea.bottom - (this.cornerWidth / 2)), (float) (this.markedArea.right + (this.cornerWidth / 2)), (float) (this.markedArea.bottom + (this.cornerWidth / 2)));
            }
            canvas.drawOval(this.ltVer, this.vertexPaint);
            canvas.drawOval(this.rtVer, this.vertexPaint);
            canvas.drawOval(this.lbVer, this.vertexPaint);
            canvas.drawOval(this.rbVer, this.vertexPaint);
        }
        if (this.isShowButtom) {
            canvas.drawBitmap(this.confirmBitmap, (Rect) null, this.confirmArea, this.mBitPaint);
            canvas.drawBitmap(this.cancelBitmap, (Rect) null, this.cancelArea, this.mBitPaint);
        }
        super.onDraw(canvas);
    }

    private void drawLeftTopPath(int i, int i2, int i3, int i4, Canvas canvas) {
        Path path = new Path();
        Path path2 = new Path();
        Path path3 = new Path();
        RectF rectF = new RectF();
        RectF rectF2 = new RectF();
        float f = (float) i;
        float f2 = (float) i3;
        rectF.set(f, f2, (float) ((this.lineLen * i2) + i), (float) ((this.lineWidth * i4) + i3));
        rectF2.set(f, f2, (float) (i + (i2 * this.lineWidth)), (float) (i3 + (i4 * this.lineLen)));
        path.rewind();
        path2.rewind();
        path3.rewind();
        path.addRect(rectF, Path.Direction.CCW);
        path2.addRect(rectF2, Path.Direction.CCW);
        path3.op(path, path2, Path.Op.UNION);
        canvas.drawPath(path3, this.vertexPaint);
    }

    public boolean onTouchEvent(MotionEvent motionEvent) {
        if (!this.isTouchAble) {
            return false;
        }
        int x = (int) motionEvent.getX();
        int y = (int) motionEvent.getY();
        int action = motionEvent.getAction();
        if (action == 0) {
            this.isAdjustMode = false;
            this.isMoveMode = false;
            this.isButtonClicked = false;
            this.adjustNum = 0;
            this.downX = x;
            this.downY = y;
            onClickListener onclicklistener = this.mOnClickListener;
            if (onclicklistener != null) {
                onclicklistener.onTouch();
            }
            if (isAreaContainPoint(this.confirmArea, x, y)) {
                this.isButtonClicked = true;
                onClickListener onclicklistener2 = this.mOnClickListener;
                if (onclicklistener2 != null) {
                    onclicklistener2.onConfirm(this.markedArea);
                }
            } else if (isAreaContainPoint(this.cancelArea, x, y)) {
                this.isButtonClicked = true;
                onClickListener onclicklistener3 = this.mOnClickListener;
                if (onclicklistener3 != null) {
                    onclicklistener3.onCancel();
                    this.endY = 0;
                    this.endX = 0;
                    this.startY = 0;
                    this.startX = 0;
                    adjustMark(0, 0);
                }
            } else if (isAreaContainPoint(this.ltVer, x, y)) {
                this.isAdjustMode = true;
                this.adjustNum = 1;
            } else if (isAreaContainPoint(this.rtVer, x, y)) {
                this.isAdjustMode = true;
                this.adjustNum = 2;
            } else if (isAreaContainPoint(this.lbVer, x, y)) {
                this.isAdjustMode = true;
                this.adjustNum = 3;
            } else if (isAreaContainPoint(this.rbVer, x, y)) {
                this.isAdjustMode = true;
                this.adjustNum = 4;
            } else if (this.markedArea.contains(x, y)) {
                this.isMoveMode = true;
            } else {
                this.isMoveMode = false;
                this.startX = (int) motionEvent.getX();
                int y2 = (int) motionEvent.getY();
                this.startY = y2;
                this.endX = this.startX;
                this.endY = y2;
            }
        } else if (action != 1) {
            if (action == 2 && !this.isButtonClicked) {
                adjustMark(x, y);
            }
        } else if (!this.isButtonClicked) {
            adjustMark(x, y);
            this.startX = this.markedArea.left;
            this.startY = this.markedArea.top;
            this.endX = this.markedArea.right;
            this.endY = this.markedArea.bottom;
            if (this.markedArea.width() > (this.confirmBitmap.getWidth() * 3) + (this.mActionGap * 3) && this.markedArea.height() > this.confirmBitmap.getHeight() * 5) {
                Rect rect = this.confirmArea;
                int width = (this.endX - this.confirmBitmap.getWidth()) - this.mActionGap;
                int height = this.endY - this.confirmBitmap.getHeight();
                int i = this.mActionGap;
                rect.set(width, height - i, this.endX - i, this.endY - i);
                Rect rect2 = this.cancelArea;
                int width2 = (this.endX - (this.confirmBitmap.getWidth() * 2)) - (this.mActionGap * 2);
                int height2 = (this.endY - this.confirmBitmap.getHeight()) - this.mActionGap;
                int width3 = this.endX - this.confirmBitmap.getWidth();
                int i2 = this.mActionGap;
                rect2.set(width2, height2, width3 - (i2 * 2), this.endY - i2);
            } else if (this.endY > getHeight() - (this.confirmBitmap.getHeight() * 3)) {
                Rect rect3 = this.confirmArea;
                int width4 = (this.endX - this.confirmBitmap.getWidth()) - this.mActionGap;
                int height3 = this.startY - this.confirmBitmap.getHeight();
                int i3 = this.mActionGap;
                rect3.set(width4, height3 - i3, this.endX - i3, this.startY - i3);
                Rect rect4 = this.cancelArea;
                int width5 = (this.endX - (this.confirmBitmap.getWidth() * 2)) - (this.mActionGap * 2);
                int height4 = (this.startY - this.confirmBitmap.getHeight()) - this.mActionGap;
                int width6 = this.endX - this.confirmBitmap.getWidth();
                int i4 = this.mActionGap;
                rect4.set(width5, height4, width6 - (i4 * 2), this.startY - i4);
            } else {
                Rect rect5 = this.confirmArea;
                int width7 = this.endX - this.confirmBitmap.getWidth();
                int i5 = this.mActionGap;
                int i6 = this.endY;
                rect5.set(width7 - i5, i6 + i5, this.endX - i5, i6 + this.confirmBitmap.getHeight() + this.mActionGap);
                Rect rect6 = this.cancelArea;
                int width8 = this.endX - (this.confirmBitmap.getWidth() * 2);
                int i7 = this.mActionGap;
                rect6.set(width8 - (i7 * 2), this.endY + i7, (this.endX - this.confirmBitmap.getWidth()) - (this.mActionGap * 2), this.endY + this.confirmBitmap.getHeight() + this.mActionGap);
            }
            if (this.cancelArea.left < 0) {
                int abs = Math.abs(this.cancelArea.left) + this.mActionGap;
                this.cancelArea.left += abs;
                this.cancelArea.right += abs;
                this.confirmArea.left += abs;
                this.confirmArea.right += abs;
            }
            onClickListener onclicklistener4 = this.mOnClickListener;
            if (onclicklistener4 != null) {
                onclicklistener4.onCancel();
            }
        }
        postInvalidate();
        return true;
    }

    private boolean isAreaContainPoint(Rect rect, int i, int i2) {
        return new Rect(rect.left - BUTTON_EXTRA_WIDTH, rect.top - BUTTON_EXTRA_WIDTH, rect.right + BUTTON_EXTRA_WIDTH, rect.bottom + BUTTON_EXTRA_WIDTH).contains(i, i2);
    }

    private boolean isAreaContainPoint(RectF rectF, int i, int i2) {
        return new RectF(rectF.left - ((float) BUTTON_EXTRA_WIDTH), rectF.top - ((float) BUTTON_EXTRA_WIDTH), rectF.right + ((float) BUTTON_EXTRA_WIDTH), rectF.bottom + ((float) BUTTON_EXTRA_WIDTH)).contains((float) i, (float) i2);
    }

    private void adjustMark(int i, int i2) {
        int i3;
        int i4;
        if (this.isAdjustMode) {
            int i5 = i - this.downX;
            int i6 = i2 - this.downY;
            int i7 = this.adjustNum;
            if (i7 == 1) {
                this.startX += i5;
                this.startY += i6;
            } else if (i7 == 2) {
                this.endX += i5;
                this.startY += i6;
            } else if (i7 == 3) {
                this.startX += i5;
                this.endY += i6;
            } else if (i7 == 4) {
                this.endX += i5;
                this.endY += i6;
            }
            this.downX = i;
            this.downY = i2;
        } else if (this.isMoveMode) {
            this.mMoveWidth = this.markedArea.width();
            this.mMoveHeight = this.markedArea.height();
            int i8 = i - this.downX;
            int i9 = i2 - this.downY;
            this.startX += i8;
            this.startY += i9;
            this.endX += i8;
            this.endY += i9;
            this.downX = i;
            this.downY = i2;
        } else {
            this.endX = i;
            this.endY = i2;
        }
        this.mNewLeft = Math.min(this.startX, this.endX);
        this.mNewTop = Math.min(this.startY, this.endY);
        this.mNewRight = Math.max(this.startX, this.endX);
        int max = Math.max(this.startY, this.endY);
        this.mNewBottom = max;
        if (this.mNewLeft < 0) {
            this.mNewLeft = 0;
        }
        int i10 = this.mNewLeft;
        int i11 = this.mWidth;
        if (i10 > i11) {
            this.mNewLeft = i11;
        }
        if (this.mNewTop < 0) {
            this.mNewTop = 0;
        }
        int i12 = this.mNewTop;
        int i13 = this.mHeight;
        if (i12 > i13) {
            this.mNewTop = i13;
        }
        if (this.mNewRight < 0) {
            this.mNewRight = 0;
        }
        if (this.mNewRight > i11) {
            this.mNewRight = i11;
        }
        if (max < 0) {
            this.mNewBottom = 0;
        }
        if (this.mNewBottom > i13) {
            this.mNewBottom = i13;
        }
        this.markedArea.set(this.mNewLeft, this.mNewTop, this.mNewRight, this.mNewBottom);
        int width = this.markedArea.width();
        int i14 = this.lineLen;
        if (width < i14 * 2) {
            int i15 = this.mNewLeft;
            int i16 = (i14 * 2) + i15;
            this.mNewRight = i16;
            int i17 = this.mWidth;
            if (i16 <= i17) {
                this.markedArea.set(i15, this.mNewTop, i16, this.mNewBottom);
            } else {
                this.mNewRight = i17;
                int i18 = i17 - (i14 * 2);
                this.mNewLeft = i18;
                this.markedArea.set(i18, this.mNewTop, i17, this.mNewBottom);
            }
        }
        int height = this.markedArea.height();
        int i19 = this.lineLen;
        if (height < i19 * 2) {
            int i20 = this.mNewTop;
            int i21 = (i19 * 2) + i20;
            this.mNewBottom = i21;
            int i22 = this.mHeight;
            if (i21 <= i22) {
                this.markedArea.set(this.mNewLeft, i20, this.mNewRight, i21);
            } else {
                this.mNewBottom = i22;
                int i23 = i22 - (i19 * 2);
                this.mNewTop = i23;
                this.markedArea.set(this.mNewLeft, i23, this.mNewRight, i22);
            }
        }
        boolean z = this.isMoveMode;
        if (z && this.mNewLeft == 0) {
            this.mNewRight = this.mMoveWidth;
        }
        if (z && this.mNewRight == (i4 = this.mWidth)) {
            this.mNewLeft = i4 - this.mMoveWidth;
        }
        if (z && this.mNewTop == 0) {
            this.mNewBottom = this.mMoveHeight;
        }
        if (z && this.mNewBottom == (i3 = this.mHeight)) {
            this.mNewTop = i3 - this.mMoveHeight;
        }
        this.markedArea.set(this.mNewLeft, this.mNewTop, this.mNewRight, this.mNewBottom);
        this.ltVer.set((float) (this.markedArea.left - (this.cornerWidth / 2)), (float) (this.markedArea.top - (this.cornerWidth / 2)), (float) (this.markedArea.left + (this.cornerWidth / 2)), (float) (this.markedArea.top + (this.cornerWidth / 2)));
        this.rtVer.set((float) (this.markedArea.right - (this.cornerWidth / 2)), (float) (this.markedArea.top - (this.cornerWidth / 2)), (float) (this.markedArea.right + (this.cornerWidth / 2)), (float) (this.markedArea.top + (this.cornerWidth / 2)));
        this.lbVer.set((float) (this.markedArea.left - (this.cornerWidth / 2)), (float) (this.markedArea.bottom - (this.cornerWidth / 2)), (float) (this.markedArea.left + (this.cornerWidth / 2)), (float) (this.markedArea.bottom + (this.cornerWidth / 2)));
        this.rbVer.set((float) (this.markedArea.right - (this.cornerWidth / 2)), (float) (this.markedArea.bottom - (this.cornerWidth / 2)), (float) (this.markedArea.right + (this.cornerWidth / 2)), (float) (this.markedArea.bottom + (this.cornerWidth / 2)));
    }

    public void setmOnClickListener(onClickListener onclicklistener) {
        this.mOnClickListener = onclicklistener;
    }

    public void setConnerColor(int i) {
        this.cornerColor = i;
        this.vertexPaint.setColor(i);
        invalidate();
    }

    public void setMarkColor(int i) {
        this.markedColor = i;
        this.markPaint.setColor(i);
        invalidate();
    }

    public void setUnmarkedColor(int i) {
        this.unmarkedColor = i;
        this.unMarkPaint.setColor(i);
        invalidate();
    }

    public int dp2px(Context context, float f) {
        return (int) TypedValue.applyDimension(1, f, context.getResources().getDisplayMetrics());
    }

    public void setRect(Rect rect) {
        Rect rect2 = new Rect(rect.left, rect.top, rect.right, rect.bottom);
        this.markedArea = rect2;
        this.startX = rect2.left;
        this.startY = this.markedArea.top;
        this.endX = this.markedArea.right;
        this.endY = this.markedArea.bottom;
        this.ltVer.set((float) (this.markedArea.left - (this.cornerWidth / 2)), (float) (this.markedArea.top - (this.cornerWidth / 2)), (float) (this.markedArea.left + (this.cornerWidth / 2)), (float) (this.markedArea.top + (this.cornerWidth / 2)));
        this.rtVer.set((float) (this.markedArea.right - (this.cornerWidth / 2)), (float) (this.markedArea.top - (this.cornerWidth / 2)), (float) (this.markedArea.right + (this.cornerWidth / 2)), (float) (this.markedArea.top + (this.cornerWidth / 2)));
        this.lbVer.set((float) (this.markedArea.left - (this.cornerWidth / 2)), (float) (this.markedArea.bottom - (this.cornerWidth / 2)), (float) (this.markedArea.left + (this.cornerWidth / 2)), (float) (this.markedArea.bottom + (this.cornerWidth / 2)));
        this.rbVer.set((float) (this.markedArea.right - (this.cornerWidth / 2)), (float) (this.markedArea.bottom - (this.cornerWidth / 2)), (float) (this.markedArea.right + (this.cornerWidth / 2)), (float) (this.markedArea.bottom + (this.cornerWidth / 2)));
        Log.d("MyMarkView", "markedAreawidth():" + this.markedArea.width());
        postInvalidate();
    }

    public void getRect(final OnRectListener onRectListener) {
        post(new Runnable() {
            /* class com.youyi.yyviewsdklibrary.View.MyMarkView.AnonymousClass2 */

            public void run() {
                if (onRectListener != null) {
                    onRectListener.result(MyMarkView.this.markedArea);
                }
                Log.d("MyMarkView", "markedAreawidth00:" + MyMarkView.this.markedArea.width());
            }
        });
    }
}
